// Copyright 2009 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef POPDIAG_UI_CONFIGFIXSCREEN_H__
#define POPDIAG_UI_CONFIGFIXSCREEN_H__

#include <QtGui/QPushButton>
#include <QtGui/QtGui>
#include "ui/browser.h"
#include "config/configverifier.h"

namespace popdiag {

class WizardPanel;

// This page shows any configuration faults found and prompts
// the user to correct them and press "retest" before proceeding.
class ConfigFixScreen : public QWizardPage {
  Q_OBJECT
 public:
  explicit ConfigFixScreen(QWidget *app);
  virtual ~ConfigFixScreen();

  void SetupUI();

  virtual bool isComplete() const;
  virtual void initializePage();
  virtual void cleanupPage();

 signals:
  void ClientConfigLogs(const QString &logs);

  public slots:
  void OnConfigChosen(VerificationResult *r);
  void Retest();

 private:
  void SetComplete(bool newval);
  void DisplayFault();

  Browser                 *fault_display_;
  QLabel                  *program_name_;
  QLabel                  *profile_name_;
  QLabel                  *profile_name_label_;
  QPushButton             *retest_button_;
  bool                     complete_;
  VerificationResult *config_;
};
}  // namespace popdiag

#endif  // POPDIAG_UI_CONFIGFIXSCREEN_H__
